enable_testing()
find_package(GTest CONFIG REQUIRED)
message(STATUS "GTest version: " ${GTEST_VERSION})


function(add_unit_test target_name)
    add_executable(${ARGV})
    target_link_libraries(${target_name} GTest::gtest GTest::gtest_main plog::plog )
    target_include_directories(${target_name} PRIVATE ${GTEST_INCLUDE_DIRS} ${src_dir})
    add_test(NAME ${target_name} COMMAND ${target_name})
endfunction()

add_unit_test(unit_test_logger unit_test_logger.cpp)
target_link_libraries(unit_test_logger trt_utils )

add_unit_test(unit_test_builder unit_test_builder.cpp)
target_link_libraries(unit_test_builder trt_builder trt_utils)

add_unit_test(unit_test_tensor unit_test_tensor.cpp)
target_link_libraries(unit_test_tensor trt_utils trt_engine)

add_unit_test(unit_test_engine unit_test_engine.cpp)
target_link_libraries(unit_test_engine trt_engine)

add_unit_test(unit_test_yolo unit_test_yolo.cpp)
target_link_libraries(unit_test_yolo trt_utils trt_engine trt_builder app_yolo)

add_unit_test(unit_test_cpp unit_test_cpp.cpp)